﻿@{
    ViewBag.Title = "请假申请";
    Layout = "~/Views/Shared/_FrameLayout.cshtml";
}
@section scripts
{


    <script>


        $(document).ready(function() {
            var config = {
                title: '请假申请单',
                url: '@Url.Action("GetList")',
                colNames: ['主键', '申请人', '请假开始时间', '请假结束时间', "天数", "事由",'创建时间', "审核状态", '流程Id'],
                colModel: [
                    { name: 'Id', index: 'Id', width: 60, key: true, hidden: true },
                    { name: 'Person', index: 'Person' },
                    { name: 'StartDate', index: 'StartDate', formatter: 'date', formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
                    { name: 'EndDate', index: 'EndDate', formatter: 'date', formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
                    { name: 'Days', index: 'Days' },
                    { name: 'Remark', index: 'Remark' },
                    { name: 'CreateDate', index: 'CreateDate', formatter: 'date', formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
                    { name: 'TaskName', index: 'TaskName' },
                    { name: 'FlowId', index: 'FlowId', hidden: true }
                ],
                sortname: 'CreateDate',
                sortorder: "desc"
            };
            WikeGrid.Load(config);


            $("#btnAudit").click(function() {

                var row = WikeGrid.GetData();
                if (row != null) {
                    $(this).button("loading");
                    window.location.href = "/Holiday/Audit?id=" + row.Id;
                } else {
                    parent.layer.alert("请选择要审核的数据");
                }
            });

            $("#btnEditHoliday").click(function() {
                var row = WikeGrid.GetData();
                
                if (row != null) {
                    if (row.FlowId != null && row.FlowId != "") {
                        top.layer.alert("已发起流程的数据不能修改");
                    } else {
                        $(this).button("loading");
                        var url = $(this).data("url");
                        if (url.indexOf("?") > 0) {
                            url = url + "&id=" + row.Id;
                        } else {
                            url = url + "?id=" + row.Id;
                        }
                        window.location.href = url;
                    }
                    
                } else {
                    top.layer.alert("请选择要编辑的数据");
                }
            });
        });
    </script>
}

 

<form id="searchToolBar" class="alert alert-info form-inline toolbarsearch" action="">
    <div class="form-group">
        <label for="keywords">关键字</label>
        <input type="text" id="keywords" name="keywords" autocomplete="off" class="form-control" placeholder="请输入关键字"/>

    </div>
    <div class="form-group">
        <label for="Person">申请人</label>
        <input type="text" id="Person" name="Person" autocomplete="off" class="form-control" placeholder="请输入申请人"/>
    </div>
    <div class="form-group">
        <label for="Days">天数</label>
        <input type="text" id="Days" name="Days" autocomplete="off" class="form-control" placeholder="请输入天数"/>
    </div>
 
    <button class="btn btn-danger" id="btnSearch" type="button">
        <i class="fa menu-icon fa-cog "></i>查询
    </button>
    <button class="btn btn-default" data-url="@Url.Action("Add")" id="btnAdd" type="button">
        添加
    </button>
    <button class="btn btn-default" data-url="@Url.Action("Edit")" id="btnEditHoliday" type="button">
        编辑
    </button>
    
    @*<button class="btn btn-default" data-url="@Url.Action("Delete")" id="btnDelete" type="button">
        删除
    </button>*@
</form>
<div class="jqGrid_wrapper">
    <table id="table_list"></table>
    <div id="pager_list"></div>
</div>

